package com.lightsh.screens;

import org.jbox2d.common.Vec2;

import android.content.Context;

import com.lightsh.graphics.ImageUtility;
import com.lightsh.gui.NormalObjectScreen;
import com.lightsh.jbox2d.R;
import com.lightsh.object.CircleObjectImpl;
import com.lightsh.object.PolygonObjectImpl;
import com.lightsh.object.RectangleObjectImpl;
import com.lightsh.utility.BallObject;

public class ObjectTestScreen extends NormalObjectScreen{

	public ObjectTestScreen(Context context, int screenW, int screenH) {
		super(context, screenW, screenH, screenW * 10, screenH * 10);		
		setBackgroundBitmap(ImageUtility.drawableToBitmap(mContext.getResources().getDrawable(R.drawable.background)));
		
		initObject();
	}
	
	private void initObject(){
		new CircleObjectImpl(this, 100, 100, 100).create();
		
		new CircleObjectImpl(this, 300, 300, 100).create();
		
		new CircleObjectImpl(this, 600, 600, 100).create();
		
		new RectangleObjectImpl(this, 900, 900, 100, 100).create();
		
		PolygonObjectImpl polygonObject = new PolygonObjectImpl(this, 1200, 1200);
		
		final Vec2[] fStarVecs = new Vec2[] { new Vec2(0, -4),
				// new Vec2(1, -2),
				new Vec2(4, -2),
				// new Vec2(2, 0),
				new Vec2(3, 3),
				// new Vec2(0, 1),
				new Vec2(-3, 3),
				// new Vec2(-2, 0),
				new Vec2(-4, -2),
		// new Vec2(-1, -2)
		};
		float scale = 10f;
		for(Vec2 vec : fStarVecs){
			polygonObject.add(vec.mul(scale));
		}
		addBodyToScreen(polygonObject);
		
		new BallObject(this, 500, 100, 100).create();
	}
}
